<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOrderTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('order', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->increments('id');
            $table->char('order_number', 20)->default('')->comment('订单编号');
            $table->integer('user_id')->comment('用户id');
            $table->string('order_name',30)->default('')->comment('收货人姓名');
            $table->string('order_tel',16)->default('')->comment('收货人手机号');
            $table->string('order_address')->default('')->comment('收货人详细地址');
            $table->string('order_code', 10)->default('')->comment('收货人邮编');
            $table->integer('order_pay')->default(1)->comment('支付方式');
            $table->decimal('order_total', 10,2)->default('0.00')->comment('订单总金额');
            $table->dateTime('order_time')->comment('下单时间');
            $table->dateTime('order_paytime')->nullable()->comment('支付时间');
            $table->tinyInteger('order_status')->default(0)->comment('订单状态');
            $table->index('order_status');
            $table->index('user_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('order');
    }
}
